home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / networking / cisco / cisco-expect.shar / ciscologin.expect < prev    next >
Text File  |  1992-08-07  |  625b  |  28 lines

  1.  
  2. proc login {args} {
  3.     global password
  4.     global enablepass
  5.  
  6.     expect    {*Password:*} {} \
  7.         timeout {timedout waiting for password prompt}
  8.     # ugly!
  9.     system sleep 1
  10.     send ${password}\r
  11.     expect {*Password:*}    {send_user Bad password\n; exit} \
  12.         {*>}        {} \
  13.         timeout        {timedout waiting for login prompt}
  14.  
  15.     if {[length $args]} {
  16.         send enable\r
  17.         expect {*Password:*}    {} \
  18.             timeout    {timedout waiting for enable password prompt; exit}
  19.         # ugly!
  20.         system sleep 1
  21.         send [index $args 0]\r
  22.         expect {*#}    {} \
  23.            {*Password:*} {send_user Wrong enable password\n; exit} \
  24.            timeout    {timedout waiting for enabled prompt; exit}
  25.     }
  26. }
  27.     
  28.